﻿using GEPL.ViewModels;
using System.Globalization;
using System.Windows;

namespace GEPL.Views
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            switch (Properties.Settings.Default.Settings_Language)
            {
                case "auto":
                    break;

                case "pl-PL":
                    CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("pl-PL");
                    CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("pl-PL");
                    break;

                case "en":
                    CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en");
                    CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("en");
                    break;

                default:
                    Properties.Settings.Default.Settings_Language = "auto";
                    break;
            }

            InitializeComponent();

            DataContext = new MainWindowViewModel(this);
        }

        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            Properties.Settings.Default.Save();
        }
    }
}